package net.da.core.manager;

import java.io.Serializable;
import java.util.Collection;

import com.google.inject.ImplementedBy;

import net.da.core.bof.PersistentObject;
import net.da.core.dao.Dao;
import net.da.core.entity.PersistentObjectEntity;

@ImplementedBy(BusinessObjectManagerImpl.class)
public interface BusinessObjectManager {

    public <E extends PersistentObject> E createBusinessObjectEmptyInstance(Class<E> cls);

    public <E extends PersistentObject> E getBusinessObjectById(Class<E> cls, Serializable id);

    public <D extends Dao> D getDao(Class<D> daoClass);

    // ======= These methods are service methods for business objects only ======= //
    public <E extends PersistentObject, T extends PersistentObjectEntity> E getBusinessObjectByEntity(Class<E> cls,
            T entity);

    public <E extends PersistentObject, T extends PersistentObjectEntity> Collection<E> getBusinessObjectsByEntities(Class<E> cls,
            Collection<T> entities);

    public <E extends PersistentObject> void save(E businessObject);

    public <E extends PersistentObject> void remove(E businessObject);
}
